from database import db
from collections import OrderedDict

class EntityBase(object):
    def to_json(self):
        fields = self.__dict__
        if "_sa_instance_state" in fields:
            del fields["_sa_instance_state"]

        return fields

class HT_UserInfo(db.Model, EntityBase):
    __tablename__ = 'HT_UserInfo'
    User_ID = db.Column(db.String(32), primary_key=True)
    User_Password = db.Column(db.String(100))
    User_Name = db.Column(db.String(100))
    User_Phone = db.Column(db.Integer)
    User_Status = db.Column(db.Integer)

    def __init__(self, User_ID, User_Password, User_Name, User_Phone, User_Status):
        self.User_ID = User_ID
        self.User_Password = User_Password
        self.User_Name = User_Name
        self.User_Phone = User_Phone
        self.User_Status = User_Status

class HT_RoleInfo(db.Model, EntityBase):
    __tablename__ = 'HT_RoleInfo'
    Role_ID = db.Column(db.String(32), primary_key=True)
    Role_Name = db.Column(db.String(100))
    Role_Type = db.Column(db.Integer)
    Role_Desc = db.Column(db.String(2000))

    def __init__(self, Role_ID, Role_Name, Role_Type, Role_Desc):
        self.Role_ID = Role_ID
        self.Role_Name = Role_Name
        self.Role_Type = Role_Type
        self.Role_Desc = Role_Desc

class HT_UserAndRole(db.Model, EntityBase):
    __tablename__ = 'HT_UserAndRole'
    User_ID = db.Column(db.String(32), primary_key=True)
    Role_ID = db.Column(db.String(32), primary_key=True)

    def __init__(self, User_ID, Role_ID):
        self.User_ID = User_ID
        self.Role_ID = Role_ID

class HT_UserAndHotel(db.Model, EntityBase):
    __tablename__ = 'HT_UserAndHotel'
    User_ID = db.Column(db.String(32), primary_key=True)
    Hotel_ID = db.Column(db.String(32), primary_key=True)

    def __init__(self, User_ID, Hotel_ID):
        self.User_ID = User_ID
        self.Hotel_ID = Hotel_ID

class HT_HotelInfo(db.Model, EntityBase):
    __tablename__ = 'HT_HotelInfo'
    Hotel_ID = db.Column(db.String(32), primary_key=True)
    Hotel_Name = db.Column(db.String(100))
    Hotel_Address = db.Column(db.String(500))
    Hotel_Desc = db.Column(db.String(2000))
    Hotel_Phone = db.Column(db.Integer)
    Hotel_Services = db.Column(db.String(500))
    Hotel_Level = db.Column(db.Integer)

    def __init__(self, Hotel_ID, Hotel_Name, Hotel_Address, Hotel_Desc, Hotel_Phone, Hotel_Services, Hotel_Level):
        self.Hotel_ID = Hotel_ID
        self.Hotel_Name = Hotel_Name
        self.Hotel_Address = Hotel_Address
        self.Hotel_Desc = Hotel_Desc
        self.Hotel_Phone = Hotel_Phone
        self.Hotel_Services = Hotel_Services
        self.Hotel_Level = Hotel_Level

class HT_RoomInfo(db.Model, EntityBase):
    __tablename__ = 'HT_RoomInfo'
    Hotel_ID = db.Column(db.String(32), primary_key=True)
    Room_Type = db.Column(db.String(100), primary_key=True)
    Room_Price = db.Column(db.FLOAT)
    Room_Quantity = db.Column(db.Integer)

    def __init__(self, Hotel_ID, Room_type, Room_Price, Room_Quantity):
        self.Hotel_ID = Hotel_ID
        self.Room_Type = Room_type
        self.Room_Price = Room_Price
        self.Room_Quantity = Room_Quantity



















